<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:useBean id="angle" class="bean.Stringtonum" scope="page"></jsp:useBean>
<jsp:useBean id="tri" class="bean.Triangle" scope="page"></jsp:useBean>
<html>
	<head>
		<title>使用JavaBean封装业务逻辑，输出三角形的面积</title>
	</head>
<body>
请输入三角形三个边的长度，并用逗号分隔：<br>
<form  method=post>
	<input type="text" name="boy">
	<input type="submit" value="提交">
</form>
<%  
	String str=request.getParameter("boy");
    if(!angle.strtonum(str)){ 
    	out.println("请输入三个数");
		return;
    }
	tri.setEdge1(angle.getNum1());
	tri.setEdge2(angle.getNum2());
	tri.setEdge3(angle.getNum3());
	if(!tri.isTriangle()){
		  out.println("您输入的三个边不能构成一个三角形！");
          return;	
	}
	out.println("三角形的面积="+tri.calArea());
%>
    <br>您输入的三个边是：<% out.print(tri.getEdge1());%>，
	<%=tri.getEdge2()%>，<%=tri.getEdge3()%>	
</body>
</html>
